package com.ittao.taoaicodemother.model.enums;

import lombok.Getter;

/**
 * VIP兑换码状态枚举
 *
 * @author <a href="https://gitee.com/it-heima-ht">程序员 Tao</a>
 */
@Getter
public enum VipRedeemCodeStatusEnum {

    UNUSED("unused", "未使用"),
    USED("used", "已使用"),
    EXPIRED("expired", "已过期");

    private final String value;

    private final String text;

    VipRedeemCodeStatusEnum(String value, String text) {
        this.value = value;
        this.text = text;
    }

    /**
     * 根据 value 获取枚举
     */
    public static VipRedeemCodeStatusEnum getEnumByValue(String value) {
        if (value == null) {
            return null;
        }
        for (VipRedeemCodeStatusEnum anEnum : VipRedeemCodeStatusEnum.values()) {
            if (anEnum.value.equals(value)) {
                return anEnum;
            }
        }
        return null;
    }
}
